﻿using GeneralDashboard.ViewModel;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GeneralDashboard.Pages
{
    /// <summary>
    /// DesignerPage.xaml 的交互逻辑
    /// </summary>
    public partial class DesignerPage : Page
    {
        public DesignerPage()
        {
            InitializeComponent();
            DataContext = ViewModel;
        }

        public DesignerViewModel ViewModel
        {
            get { return Resources["ViewModel"] as DesignerViewModel; }
            set { Resources["ViewModel"] = value; }
        }

        private void ScrollViewerEx_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetData(typeof(ControllViewModel)) is ControllViewModel controller)
            {
                Content.Children.Add(new Button { Width = 100, Height = 80, Content = "Button" });
            }
            if (e.Data.GetData(typeof(DataSourceViewModel)) is DataSourceViewModel dataSource)
            {
                MessageBox.Show(dataSource.Title);
            }
        }
    }
}
